import type { ApiType, mainArticleList } from '.';
import { request } from '../request';

/* 用户信息查询 */
export function personalUser(params: { id: string }) {
  return request<{ hasPasswd: boolean } & Api.UserInfo>({
    url: '/personal/user',
    method: 'post',
    data: params,
  });
}

export function personalArticle(
  params: {
    userId: string;
    text: string;
    /* create | liked | fav */
    type: string;
  } & Api.PageParam,
) {
  return request<ApiType<typeof mainArticleList>['Return']>({
    url: '/personal/article',
    method: 'post',
    data: params,
  });
}

export function personalUserList(
  params: {
    userId: string;
    text: string;
    /* fav | fans */
    type: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.UserInfo>>({
    url: '/personal/user-list',
    method: 'post',
    data: params,
  });
}

export function personalFollowTag(
  params: {
    userId: string;
    text: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<Api.TagInfo>>({
    url: '/personal/follow-tag',
    method: 'post',
    data: params,
  });
}

export function personalFollowTopic(
  params: {
    userId: string;
    text: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<Api.TopicInfo>>({
    url: '/personal/follow-topic',
    method: 'post',
    data: params,
  });
}

export function personalQryUser(
  params: {
    text: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.UserInfo>>({
    url: '/personal/qry-user',
    method: 'post',
    data: params,
  });
}

export function personalQryTag(
  params: {
    text: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.TagInfo>>({
    url: '/personal/qry-tag',
    method: 'post',
    data: params,
  });
}

export function personalQryTopic(
  params: {
    text: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.TopicInfo>>({
    url: '/personal/qry-topic',
    method: 'post',
    data: params,
  });
}
